#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	long long a=0, b=0, k=0, comax=0,comin=0;
	scanf("%lld %lld", &a, &b);
	k = a * b;
	while(a&&b)
	{
		if (a > b)
			a %= b;
		else
			b %= a;
	}
	comax = a > b ? a : b;
	comin = k / comax;
	printf("%lld", comax + comin);
	return 0;
}

